package com.jeecms.cms.dao.assist.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.jeecms.cms.dao.assist.CmsFlashlogoDao;
import com.jeecms.cms.entity.assist.CmsFlashlogo;
import com.jeecms.common.hibernate3.Finder;
import com.jeecms.common.hibernate3.HibernateBaseDao;

@Repository
public class CmsFlashlogoDaoImpl extends
		HibernateBaseDao<CmsFlashlogo, Integer> implements CmsFlashlogoDao {
	@SuppressWarnings("unchecked")
	public List<CmsFlashlogo> getList(
			Boolean enabled) {
		Finder f = Finder.create("from CmsFlashlogo bean where 1=1");
		if (enabled != null) {
			f.append(" and bean.enabled=:enabled");
			f.setParam("enabled", enabled);
		}
		f.append(" order by bean.priority asc");
		return find(f);
	}

	public CmsFlashlogo findById(Integer id) {
		CmsFlashlogo entity = get(id);
		return entity;
	}

	public CmsFlashlogo save(CmsFlashlogo bean) {
		getSession().save(bean);
		return bean;
	}

	public CmsFlashlogo deleteById(Integer id) {
		CmsFlashlogo entity = super.get(id);
		if (entity != null) {
			getSession().delete(entity);
		}
		return entity;
	}

	@Override
	protected Class<CmsFlashlogo> getEntityClass() {
		return CmsFlashlogo.class;
	}
}